<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="MyTag" uri="/WEB-INF/tlds/checkSession.tld"%>
<%@ page language="java" import="fsmi.model.*,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>homeworkList</title>
</head>
<body>
	<MyTag:checkSession />
	<h2>Homework</h2>
	<%!List<HomeworkBean> committed = null;%>
	<%!List<HomeworkBean> uncommitted = null;%>
	<%!List<HomeworkBean> failed = null;%>
	<jsp:useBean id="homeworkList" scope="session"
		class="fsmi.model.HomeworkListBean"></jsp:useBean>
	<%
		committed = homeworkList.getCommitted();
	%>
	<%
		uncommitted = homeworkList.getUncommitted();
	%>
	<%
		failed = homeworkList.getFailed();
	%>
	<%!Iterator<HomeworkBean> committedItor = null;%>
	<%!Iterator<HomeworkBean> uncommittedItor = null;%>
	<%!Iterator<HomeworkBean> failedItor = null;%>
	<%
		if (committed != null)
			committedItor = committed.iterator();
		if (uncommitted != null)
			uncommittedItor = uncommitted.iterator();
		if (failed != null)
			failedItor = failed.iterator();
	%>
	<%!HomeworkBean homework = null;%>
	<table>
		<tr>
			<td>ID</td>
			<td>course</td>
			<td>name</td>
			<td>deadline</td>
			<td>grade</td>
		</tr>
		<tr>
			<td>
				<h3>committed</h3>
			</td>
		</tr>
		<%
			while (committedItor.hasNext()) {
				homework = committedItor.next();
		%>
		<tr>
			<td><%=homework.getHid()%></td>
			<td><%=homework.getCid()%></td>
			<td><%=homework.getHname()%></td>
			<td><%=homework.getDeadline()%></td>
			<td><%=homework.getGrade()%></td>
		</tr>
		<%
			}
		%>
		<tr>
			<td>
				<h3>uncomitted</h3>
			</td>
		<tr>
			<%
				while (uncommittedItor.hasNext()) {
					homework = uncommittedItor.next();
			%>
		
		<tr>
			<td><%=homework.getHid()%></td>
			<td><%=homework.getCid()%></td>
			<td><%=homework.getHname()%></td>
			<td><%=homework.getDeadline()%></td>
			<td><%=homework.getGrade()%></td>
		</tr>
		<%
			}
		%>
		<tr>
			<td>
				<h3>failed</h3>
			</td>
			<%
				while (failedItor.hasNext()) {
					homework = failedItor.next();
			%>

		<tr>
			<td><%=homework.getHid()%></td>
			<td><%=homework.getCid()%></td>
			<td><%=homework.getHname()%></td>
			<td><%=homework.getDeadline()%></td>
			<td><%=homework.getGrade()%></td>
		</tr>
		<%
			}
		%>


	</table>
</body>
</html>